/*企业信息管理-列表*/
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:frametrim/route/Routes.dart';
import 'package:frametrim/utility/sq_color.dart';
import 'package:frametrim/views/appbar_search.dart';
import 'package:frametrim/views/background_view.dart';
import 'package:get/get.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';

import '../../appviews/lineToTextView.dart';
import '../../views/appbar_search_toAppbar.dart';

class CompanyMessManagePage extends StatefulWidget {
  @override
  State<StatefulWidget> createState() => CompanyMessManageState();
}

class CompanyMessManageState extends State<CompanyMessManagePage> {
  TextEditingController _controller = TextEditingController();

  RefreshController _refreshController =
      RefreshController(initialRefresh: false);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: SQColor.color_background,
      body: AnnotatedRegion(
        value: SystemUiOverlayStyle.dark,
        child: Column(
          children: [
            AppbarSearchUseAppBarTitle(
              imgStr: 'image/imv_back.png',
              controller: _controller,
              backgroundColor: SQColor.color_background,
              isNeedCenter: false,
              callback: (str) {},
              hiteText: "请输入企业名称",
              isNeedJump: true,
              isShowSearchImg: false,
            ),
           Expanded(child:  SmartRefresher(
               enablePullDown: true,
               enablePullUp: true,
               controller: _refreshController,
               onRefresh: () async {
                 // currentPage = 1;
                 // getData("");
                 Future.delayed(Duration(milliseconds: 2000), () {
                   _refreshController.refreshCompleted();
                 });
               },
               onLoading: () async {
                 // currentPage++;
                 // getData("");
                 Future.delayed(Duration(milliseconds: 2000), () {
                   _refreshController.loadComplete();
                   // _refreshController.loadNoData();
                 });
               },
               child: ListView.builder(
                 shrinkWrap: true,
                 itemBuilder: (context, index) {
                   return buildItem();
                 },
                 itemCount: 5,
               )))
          ],
        ),
      ),
    );
  }

  /*item*/
  Widget buildItem() {
    return GestureDetector(
      onTap: () {
        Get.toNamed(Routes.Company_Mess_Manage_Details);
      },
      child: BackgroundView(
        mHorizontalMargin: 12,
        mVerticalTopMargin: 10,
        mHorizontalPadding: 10,
        mVerticalPadding: 10,
        mVerticalBottomMargin: 0,
        widget: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            LineToTextView(
                text1: "郑州众一建筑劳务分包有限公司",
                textSize: 16,
                isBind: false,
                textColor: SQColor.color_3D3D3D),
            Text('企业类型：类型一',style: TextStyle(fontSize: 14,color: SQColor.color_60black)),
            SizedBox(height: 7),
            Text('参与项目：56',style: TextStyle(fontSize: 14,color: SQColor.color_60black)),
            SizedBox(height: 7),
            Text('统一社会信用代码：123456789001212121',style: TextStyle(fontSize: 14,color: SQColor.color_60black)),
          ],
        ),
      ),
    );
  }
}
